#include<iostream>
#include<string>
using namespace std;
string s;
int main()
{
	cin >> s;
	int ans = s.size();
	while (s.find("iwii") != -1)s.erase(s.find("iwii"), 3);
	while (s.find("iiwi") != -1)s.erase(s.find("iiwi") + 1, 3);
	while (s.find("iwi") != -1)s.erase(s.find("iwi"), 3);
	cout << (ans - s.size()) / 3 << endl;
	return 0;
}